Many modern computer communication systems are based on having a layered protocol stack. FIG. 1 illustrates an example of such a stack 505. The particular stack depicted in the left-hand portion of FIG. 1 comprises five layers, 501A, 501B, 501C, 501D and 501E, although it will be appreciated that other systems may have a different number of layers. In this configuration, the lower layers are closest to the network hardware, and are typically responsible for aspects such as Error Correction Coding (ECC), while the higher layers are more involved with the application programs that are utilising the communication stack.
As an illustration of one typical stack 505, layer E 501E may represent an Ethernet frame layer. This is responsible for generating frames suitable for transmission over an Ethernet link, normally part of a local area network (LAN). Other hardware architectures may be deployed instead of Ethernet, including asynchronous transfer mode (ATM), token ring, and so on.
Above the Ethernet layer is most commonly an Internet Protocol (IP) layer for layer D 501D, which is then generally followed by a transmission control protocol (TCP) layer as layer C (501C). The TCP/IP layers are normally provided together, and since they form the basic protocol that defines communications on the Internet, they have become extremely popular and widespread over recent years. However, there are alternative possibilities for these layers C and D, such as SPX/IPX.
As an example of the next layer in the stack 505, namely layer B 501B, this may be the hypertext transfer protocol (HTTP). This is the standard protocol used by web browsers to request information from web servers in the WorldWideWeb, and runs on top of TCP/IP. Other protocols that could alternatively be used for layer B include the file transfer protocol (FTP), which also runs on top of TCP/IP.
The top layer of the protocol stack 505, namely layer A 501A, might be the use of a Remote Procedure Call (RPC) mechanism based on Extensible Mark up Language (XML). Another possibility here would be the Simple Object Access Protocol (SOAP). This top layer is then called directly by applications running on the system that supports communications stack 505.
It will be appreciated that the number of layers may vary from one system to another, and also depending on which particular application is using the stack 505. For example, a web browser may interact directly with the HTTP layer (layer B 501B) without using a higher protocol layer such as XML/RPC. Likewise, lower down the stack 505 there may be more or fewer layers, depending on the particular network hardware being utilised, and also the particular software implementation adopted for the stack 505.
FIG. 1A shows the transmission of a packet 510 through the protocol stack 505 of FIG. 1. A parcel or chunk of data 511 is supplied to the top layer in the stack 505, namely layer A 501A, by an application that wishes to send the data parcel 511 out over the network. Usually, as the packet 510 is passed from one protocol layer down to the next protocol layer, some header information is prepended to the packet received from the layer above. In addition, some layers may also append a trailer to the packet as well (not shown in FIG. 1A).
Therefore as the data packet 510 is initially passed into layer A 501A, it comprises only data chunk 511. However, when it is passed out of layer A 501 down to layer B 501B as data packet 510A, a header portion (shown as AH) has been prepended to data chunk 511 by layer A 501A. Following the packet further down, layer B 501B prepends its own protocol header (BH) to packet 510A to create packet 510B, which is passed down to layer C 501C. This process is then repeated down through the protocol stack 505, with layer C 501C prepending header portion CH to make packet 510C, layer D 501D prepending header portion DH to make packet 510D, and layer E 501E prepending header portion EH to make packet 510E. It is this packet 501E that is finally passed out onto the network from the bottom of the stack 505.
The final output data packet 510E in FIG. 1A therefore comprises five separate header components, AH, BH, CH, DH, and EH, one from each layer of the protocol stack. It will be appreciated that in combination these headers should, if possible, be small compared to the data portion 511; if this is not the case, then bandwidth communications efficiency will be rather poor. (Note that although in FIG. 1A the headers for the different layers are shown as the same size, in practice the header size will typically vary from one layer to another).
The header prepended by each layer comprises information for that layer to perform its appropriate processing tasks. For example, the header (EH) from layer E 501E typically includes an ECC portion, while the header in the IP layer 501D generally includes an Internet address and other associated information. Note that a layer can only interpret its own header—any other headers present are simply regarded as part of the data. For example, layer C regards packet 510C as comprising two portions, namely header C and a remaining portion which layer C simply treats as data (i.e. the message to be processed). It is quite transparent to layer C that this remaining data portion in fact includes two other headers (BH+AH) in combination with the original data chunk 511.
Considering now the receipt of an incoming packet from a communications network, the opposite chain of processing occurs. Thus rather than adding protocol headers to the packet, each layer instead has to strip out the protocol header associated with that particular layer, before passing the remainder of the packet up to the next layer in the protocol stack. (Each layer also has to strip out any packet trailers associated with that particular layer).
For example, when a packet 510E is received over a network into layer E 501E, this layer removes the protocol header element for that layer (EH) and performs any relevant processing (such as checking that the ECC is correct, in order to confirm that the packet has not been corrupted at all during transmission). Layer E 501E then passes the remaining packet 510D (i.e. the received packet 501E, but now stripped of header EH) up to layer D 501D. The process then repeats layer by layer, until layer A 501A strips its protocol header (AH) from packet 510A. This leaves just the original data portion 511 in packet 510 to be passed up to the receiving application.
The use of a multilayered communications stack 505 such as shown in FIGS. 1 and 1A has many advantages. In particular it isolates individual layers from having to know the details of the particular hardware and protocol stack beneath or above them, and for this reason it has become very widely adopted in computer communication systems. Nevertheless, certain difficulties remain with a practical implementation of protocol stack SOS. In particular, there can be a significant amount of data copying as a packet 510 progresses up the communications stack. This represents an expensive and time-consuming memory operation.
One reason for such copying is that data to be passed from one layer to the next layer is frequently not located on an appropriate byte boundary. For example, when packet 510E is initially received into a system, it will typically be properly aligned on a word boundary (e.g. a four-byte boundary or such like). However, protocol header EH itself may not comprise a whole number of words, and indeed may potentially vary in size from one packet to another. Thus once this protocol header EH has been stripped by processing within layer E 501E, the resulting packet (corresponding to packet 510D) may well not be aligned on a word boundary. Consequently, layer E (501E) cannot pass a simple reference to packet 510D, as created within packet 510E, up to layer D, since such a reference can only be used with word-aligned data. Rather, layer E typically has to generate a fresh copy of packet 510D, by duplicating what it regards as the data portion of packet 510E (i.e. headers DH, CH, BH and AH, plus data chunk 511) onto a word boundary. Layer E is then able to pass a reference to this newly created (copied) packet 510D up to layer D.
This process is then repeated at each successive layer in the protocol stack 505. Thus the data portion 511 may be copied five times (once for each layer in the protocol stack) before it is finally made available to the receiving application. It will be appreciated that this copying represents a significant processing overhead in handling incoming data communications, especially since, as indicated above, the data portion 511 normally forms the major portion of packet 510.
A further problem is that the size of communications packet to be utilised may vary from one layer to another. Thus although it is generally desirable for reasons of bandwidth efficiency for the data portion 511 to be large compared to the header portions (AH, BH, etc.), there are also factors that limit the packet size that can be usefully employed in a given situation. For example, in some cases the network or protocol architecture may have an intrinsic constraint on packet size (e.g. ATM has a fixed cell size). In other circumstances, the packet size may be limited for performance reasons, such as when the sending site is configured to wait for an acknowledgement that a packet has safely arrived at its destination before continuing with other processing.
The optimum packet size in any given situation can also depend on the error rate (which may vary according to environmental circumstances). Thus if data is lost or corrupted during transmission, and this is detected (but not corrected) by the ECC, then the relevant packet needs to be re-transmitted. If too large a packet size is adopted, then the chance of a packet being transmitted without corruption becomes small. Consequently, the proportion of packets that have to be re-transmitted rises, and so efficiency drops.
The above factors can lead to different layers in the protocol stack using different packet sizes. In particular, although FIG. 1A shows a one-to-one correspondence for packet 510 between the different layers of the protocol stack, it is common in practice for a packet to get subdivided into smaller packets as it descends a protocol stack. Conversely, received packets then get (re)assembled into larger packets as they ascend a protocol stack.
This is illustrated schematically in FIG. 1B, which shows a protocol stack comprising Layer A and Layer B. Initially Layer A receives a packet 540 comprising data segment 531. Layer A prepends header AH 535 to this data segment to form packet 540A, which is then passed to Layer B. As previously explained, from the perspective of Layer B, packet 540A simply represents data to be transmitted—in other words, the division of packet 540A into a header portion 535 and a data portion 531 is transparent to Layer B.
It is assumed that Layer B utilises a smaller packet size than Layer A (e.g. perhaps because of the physical characteristics of the particular network link involved). Accordingly, Layer B divides packet 540A into two packets 540B1, 540B2, the first containing the header AH 535 and a portion of the data 531 (denoted as 531A), the second containing the remainder of data 531 (denoted 531B). Layer B also prepends its own header to each of the two packets, namely header BH1 536A for packet 540B1 and header BH2 536B for packet 540B2. Packets 540B1 and 540B2 can now be passed to any other (lower) levels in the communication stack. These lower levels may potentially perform further subdivisions, before transmitting the packets out over the relevant communications link.
Now consider the reverse process, in which packets 540B1 and 540B2 are received over a network link into Layer B. As described in relation to FIG. 1A, when Layer B receives these packets it strips out the associated headers for this layer, namely BH1 536A and BH2 536B. Layer B then (re)assembles packet 540A by combining the data portion from packet 540B1 (i.e. AH 535 in conjunction with data 531A) and the data portion from packet 540B2 (i.e. data 531B).
Unfortunately, combining packets 540B1 and 540B2 into a single packet 540A generally involves having to copy the data of the packet. Thus even if packets 540B1 and 540B2 are stored contiguously in Layer B, header BH2 536B will be sandwiched between data segment 531A and data segment 531B. Accordingly, once the header portion BH2 536B has been stripped out by Layer B, there will be a gap between the data segments 531A and 531B. Therefore, in order to generate a single packet 540A that contains data 531 in a contiguous block, Layer B copies the data segments of packets 540B1 and 540B2 into a new packet where these two segments are adjacent to one another. This new packet is then passed to Layer A as packet 540A. It will be appreciated that the data copying associated with the reassembly of such subdivided packets again represents a significant overhead in handling incoming data communications.